package response

import "strings"

// model.go 响应相关通用结构体

type Response struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

func (r Response) Body(data any) Response {
	r.Data = data
	return r
}
func (r Response) MsgReplace(key, value string) Response {
	r.Message = strings.ReplaceAll(r.Message, key, value)
	return r
}

// MongoInitPost mongo启动完成消息
type MongoInitPost struct {
}

func (m MongoInitPost) MessageType() string {
	return "mongo_init_complete"
}
func (m MongoInitPost) ChannelLent() int {
	return 1
}

// 响应码系统缓存 项目启动时自动加载
var RespMap = map[string]RespCode{}
